Convolutions of cameraman.jpg with Dx, Dy, and gradient magnitude filters
Approach Used and Results
Images to the left are original copies, the ones to the right are binarized with threshold \(h=0.17\). We are working with the first channel of cameraman.png. Given a grayscale imageim
, we use scipy.signal.convolve2d(im,Dx,mode='same',boundary='symm')
in order to compute the convolution of our image with some filter. Observe that \(f\star D_x\) can detect vertical edges, while \(f\star D_y\) can detect horizontal edges. Finally, in order to find the gradient magnitude image, we simply compute \(\sqrt{(f\star D_x)^2 + (f\star D_y)^2} \).
Original image
Choice of thresh
in binarizing an image
When we binarize an image, the function of 0<=thresh<=1
is to promote all values \(x\ge \texttt{thresh} \) to \(1\) and send the remaining values to \(0\). The advantage with choosing lower thresh
is that we get better-defined, thicker edges. However, pushing this too far can lead to the emergence of non-existent edges and noise in the image, so a balance point needs to be found empirically. As stated before, thresh=0.17
was used here.